"""Initial

Revision ID: 64f9b1022e5d
Revises: 
Create Date: 2024-02-24 13:13:33.334550

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "64f9b1022e5d"
down_revision = None
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "user",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("telegram_id", sa.BigInteger(), nullable=False),
        sa.Column("username", sa.String(), nullable=False),
        sa.Column("phone_number", sa.String(), nullable=False),
        sa.Column("created_at", sa.DateTime(), server_default=sa.text("now()"), nullable=True),
        sa.Column("updated_at", sa.DateTime(), server_default=sa.text("now()"), nullable=True),
        sa.PrimaryKeyConstraint("id", name=op.f("pk_user")),
        sa.UniqueConstraint("telegram_id", name=op.f("uq_user_telegram_id")),
    )
    op.create_table(
        "bill",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("payment_method", sa.Enum("crypto", "qiwi", name="paymentmethod"), nullable=False),
        sa.Column("summ", sa.Float(), nullable=False),
        sa.Column("invoice_id", sa.String(), nullable=False),
        sa.Column("status", sa.Enum("paid", "waiting_payment", "payment_failed", name="billstatus"), nullable=False),
        sa.Column("user_id", sa.Integer(), nullable=False),
        sa.Column("created_at", sa.DateTime(), server_default=sa.text("now()"), nullable=True),
        sa.Column("updated_at", sa.DateTime(), server_default=sa.text("now()"), nullable=True),
        sa.ForeignKeyConstraint(["user_id"], ["user.id"], name=op.f("fk_bill_user_id_user")),
        sa.PrimaryKeyConstraint("id", name=op.f("pk_bill")),
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("bill")
    op.drop_table("user")
    # ### end Alembic commands ###
